package edu.unlv.cs.ladders.entities;

import java.lang.String;
import java.lang.SuppressWarnings;
import javax.persistence.EntityManager;
import javax.persistence.Query;

privileged aspect Participant_Roo_Finder {
    
    @SuppressWarnings("unchecked")
    public static Query Participant.findParticipantsByUsernameEquals(String username) {
        if (username == null || username.length() == 0) throw new IllegalArgumentException("The username argument is required");
        EntityManager em = Participant.entityManager();
        Query q = em.createQuery("SELECT Participant FROM Participant AS participant WHERE participant.username = :username");
        q.setParameter("username", username);
        return q;
    }
    
    @SuppressWarnings("unchecked")
    public static Query Participant.findParticipantsByEnabled(boolean enabled) {
        EntityManager em = Participant.entityManager();
        Query q = em.createQuery("SELECT Participant FROM Participant AS participant WHERE participant.enabled = :enabled");
        q.setParameter("enabled", enabled);
        return q;
    }
    
    @SuppressWarnings("unchecked")
    public static Query Participant.findParticipantsByEnabledAndAccountNonExpiredAndAccountNonLockedAndCredentialsNonExpiredAndUsernameEquals(boolean enabled, boolean accountNonExpired, boolean accountNonLocked, boolean credentialsNonExpired, String username) {
        if (username == null || username.length() == 0) throw new IllegalArgumentException("The username argument is required");
        EntityManager em = Participant.entityManager();
        Query q = em.createQuery("SELECT Participant FROM Participant AS participant WHERE participant.enabled = :enabled AND participant.accountNonExpired = :accountNonExpired AND participant.accountNonLocked = :accountNonLocked AND participant.credentialsNonExpired = :credentialsNonExpired AND participant.username = :username");
        q.setParameter("enabled", enabled);
        q.setParameter("accountNonExpired", accountNonExpired);
        q.setParameter("accountNonLocked", accountNonLocked);
        q.setParameter("credentialsNonExpired", credentialsNonExpired);
        q.setParameter("username", username);
        return q;
    }
    
}
